< previous page page_619 next page >

Page 619
To make it easier to access the character in the code, add the following definition to the form:
Dim MyAgent As IAgentCtlCharacter
This definition allows you to refer to the character by the object name instead of the fully qualified Agent1.Characters name. To use this object, add the following line of code immediately after the Load statement:
Set MyAgent = Agent1.Characters(Genie)
With just these three code segments, you now have complete access to the character from within the application. To see how this works, add a command button to the form so that you can display the character. Add the following code line to the command button click event:
MyAgent.Show
Now, run the application and click the command button to display the character, as shown in Figure B.3.
12181-0619a.gif
Figure B.3.
Displaying the character from within the application.
Notice that the character appears at the top, left of the screen. This is the default position. By using the Move To method, you can position the character anywhere you want, before or after it's displayed. Add the following code immediately before the Show statement:
MyAgent.MoveTo 320, 240

 
< previous page page_619 next page >

If you like this book, buy it!